package team.seekers.catering.common.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum TimeTypeEnum implements IEnum<Integer> {
    /**
     * 11:20-->11:30
     */
    ELEVEN_TWENTY_THIRTY("11:20 ~ 11:30",0," 11:00:00"),
    /**
     * 11:30-->11:40
     */
    ELEVEN_THIRTY_FORTY("11:30 ~ 11:40", 1," 11:00:00"),
    /**
     * 11:40-->11:50
     */
    ELEVEN_FORTY_FIFTY("11:40 ~ 11:50", 2," 11:00:00"),
    /**
     * 11:50-->12:00
     */
    ELEVEN_FIFTY_SIXTY("11:50 ~ 12:00", 3," 11:00:00"),

    /**
     * 12:00-->12:10
     */
    TWELVE_ZERO_TEN("12:00 ~ 12:10", 4," 13:00:00"),

    /**
     * '12:10-->12:20
     */
    TWELVE_TEN_TWENTY("12:10 ~ 12:20", 5," 12:00:00"),

    /**
     * 12:20-->12:30
     */
    TWELVE_TWENTY_THIRTY("12:20 ~ 12:30", 6," 12:00:00"),
    /**
     * 12:20-->12:40
     */
    TWELVE_THIRTY_FORTY("12:30 ~ 12:40", 7," 12:00:00"),
    /**
     * 17:10-->17:20
     */
    SEVENTEEN_TEN_TWENTY("17:10 ~ 17:20", 8," 17:00:00"),
    /**
     * 17:20-->17:30
     */
    SEVENTEEN_TWENTY_THIRTY("17:20 ~ 17:30",9," 17:00:00"),
    /**
     * 17:30-->17:40
     */
    SEVENTEEN_THIRTY_FORTY("17:30 ~ 17:40", 10," 17:00:00"),
    /**
     * 17:40-->17:50
     */
    SEVENTEEN_FORTY_FIFTY("17:40 ~ 17:50", 11," 17:00:00"),
    /**
     * 17:50-->18:00
     */
    SEVENTEEN_FIFTY_SIXTY("17:50 ~ 18:00", 12," 17:00:00"),

    /**
     * 18:00-->18:10
     */
    EIGHTEEN_ZERO_TEN("18:00 ~ 18:10", 13," 18:00:00"),

    /**
     * '18:10-->18:20
     */
    EIGHTEEN_TEN_TWENTY("18:10 ~ 18:20", 14," 18:00:00"),

    /**
     * 18:20-->18:30
     */
    EIGHTEEN_TWENTY_THIRTY("18:20 ~ 18:30", 15," 18:00:00");

    private String time;
    private int type;
    private String endTime;

    TimeTypeEnum(String time, int type, String endTime) {
        this.time = time;
        this.type = type;
        this.endTime = endTime;
    }

    public static TimeTypeEnum getByType(Integer type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    @Override
    public Integer getValue() {
        return this.type;
    }
}
